//package com.ruoyi.business.config;
//
//import com.ruoyi.business.constant.TradeConstants;
//import com.ruoyi.business.service.OnTicketHandler;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.listener.ChannelTopic;
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
//
//@Configuration
//public class RedisMessageListenerConfig {
//
//    @Autowired
//    private OnTicketHandler autoOrderSubscriber;
//
//    @Autowired
//    private OnTicketHandler profitOrLossStopSubscriber;
//    @Autowired
//    private OnTicketHandler ticketDataSaveSubscriber;
//
//
//
//    @Bean
//    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
//        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
//        container.setConnectionFactory(connectionFactory);
//
//        // 订阅同一个频道，并关联不同的消息处理器
//        container.addMessageListener(autoOrderSubscriberListener(), new ChannelTopic(TradeConstants.TICKET_CHANNEL));
////        container.addMessageListener(hedgeOrderSubscriberListener(), new ChannelTopic(TradeConstants.TICKET_CHANNEL));
//        container.addMessageListener(profitOrLossStopSubscriberListener(), new ChannelTopic(TradeConstants.TICKET_QUEUE));
//        container.addMessageListener(ticketDataSaveSubscriberListener(), new ChannelTopic(TradeConstants.TICKET_QUEUE));
//        return container;
//    }
//
//    @Bean
//      MessageListenerAdapter autoOrderSubscriberListener() {
//        return new MessageListenerAdapter(autoOrderSubscriber, "onTicket");
//    }
////    @Bean
////    MessageListenerAdapter hedgeOrderSubscriberListener() {
////        return new MessageListenerAdapter(hedgeOrderSubscriber, "onTicket");
////    }
//
//    @Bean
//    MessageListenerAdapter profitOrLossStopSubscriberListener() {
//        return new MessageListenerAdapter(profitOrLossStopSubscriber, "onTicket");
//    }
//    @Bean
//    MessageListenerAdapter ticketDataSaveSubscriberListener() {
//        return new MessageListenerAdapter(ticketDataSaveSubscriber, "onTicket");
//    }
//}
//

